package com.tianqu.tms.core.base;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;

/**
 * 
 * @author liugang
 *
 */
public class TmsValidatorForm extends ValidatorForm{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 验证funcId是否存在
	 */
	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
		ActionErrors errors =  super.validate(mapping,request);
		if(errors != null && errors.size() > 0){
		    request.setAttribute("funcId",((TmsActionMapping) mapping).getFuncId());
		    UserContext uc = (UserContext)request.getSession().getAttribute(TmsAction.APPLICATION_USER_CONTEXT_KEY);
		    request.setAttribute(TmsAction.VIEWHELP,uc.getAttribute(TmsAction.VIEWHELP));
		}
		return errors;
	}
}
